package com.swanclouds.redfish.updates.domin;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.updates.UpdateFirmware;

import java.util.List;
import java.util.Map;

/**
 * Author:      HuangFuYuHui
 * Title:       UpdateFirmware
 * Description: TODO
 * Date:        2022/7/29 17:35
 */
public class UpdateFirmwareModel implements UpdateFirmware {
    /**
     * 指定升级服务资源的访问路径
     */
    @JsonProperty("@odata.id")
    private String dataId;

    /**
     * 固件升级任务资源模型的OData描述信息
     */
    @JsonProperty("@odata.context")
    private String context;

    /**
     * 固件升级任务资源的类型
     */
    @JsonProperty("@odata.type")
    private String type;

    /**
     * 固件升级任务资源的Id
     */
    @JsonProperty("Id")
    private String id;

    /**
     * 固件升级任务资源的名称
     */
    @JsonProperty("Name")
    private String name;

    /**
     * 升级任务运行的当前状态，包括：
     * New
     * Starting
     * Running
     * Suspended
     * Interrupted
     * Pending
     * Stopping
     * Completed
     * Killed
     * Exception
     */
    @JsonProperty("TaskState")
    private String taskState;

    /**
     * 当前升级完成进度
     */
    @JsonProperty("PercentComplete")
    private Integer percentComplete;

    /**
     * 升级任务开始的时间
     */
    @JsonProperty("StartTime")
    private String startTime;

    /**
     * 升级任务状态的描述信息
     */
    @JsonProperty("Messages")
    private List<String> messages;

    /**
     * 自定义属性信息
     */
    @JsonProperty("Oem")
    private Map<String, Object> oem;

    /**
     * 指定升级服务资源的访问路径
     * @return dataId
     */
    @Override
    public String getDataId() {
        return this.dataId;
    }

    /**
     * 指定升级服务资源的OData描述信息
     * @return context
     */
    @Override
    public String getContext() {
        return this.context;
    }

    /**
     * 指定升级服务资源的类型
     * @return type
     */
    @Override
    public String getType() {
        return this.type;
    }

    /**
     * 系统资源的ID
     * @return Id
     */
    @Override
    public String getId() {
        return this.id;
    }

    /**
     * 指定升级服务资源的名称
     * @return Name
     */
    @Override
    public String getName() {
        return this.name;
    }

    public void setDataId(String dataId) {
        this.dataId = dataId;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTaskState() {
        return taskState;
    }

    public void setTaskState(String taskState) {
        this.taskState = taskState;
    }

    public Integer getPercentComplete() {
        return percentComplete;
    }

    public void setPercentComplete(Integer percentComplete) {
        this.percentComplete = percentComplete;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public List<String> getMessages() {
        return messages;
    }

    public void setMessages(List<String> messages) {
        this.messages = messages;
    }

    public Map<String, Object> getOem() {
        return oem;
    }

    public void setOem(Map<String, Object> oem) {
        this.oem = oem;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "UpdateFirmwareModel {" +
                "dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", TaskState='" + taskState + '\'' +
                ", PercentComplete='" + percentComplete + '\'' +
                ", StartTime=" + startTime +
                ", Messages=" + messages +
                ", Oem=" + oem +
                '}';
    }
}
